
<?php
	include("DBConn.php");
	$item_name = $_POST['item_name'];
?>
<html>
<body>
<?php
	$link = connectToDB();
	$strQuery = "select * from item_status where ITEM_NAME='$item_name'";
	$result = mysql_query($strQuery) or die(mysql_error());

	$rowCount=mysql_num_rows($result);
	if($rowCount==0){
		echo "<center><h2>Item not found!</h2></center>";
	}
	else{
	echo "<p/><center><img src='happypedobear2.bmp' width=50% height=75%></center>";
	
	?>
		<center>
		<table border="1" cellspacing="0" width="90%">
			<tr>
			<?php
			
			while ($field=mysql_fetch_field($result)) {
			echo "<th>";
			echo "<center>$field->name</center>";
			echo "</th>";
			}
			echo "</tr>";

			while ($row = mysql_fetch_row($result)) {
			echo "<tr>";
			for ($i=0; $i<mysql_num_fields($result); $i++) {
			echo "<td>";
			if($row[$i]!='0000-00-00 00:00:00')
				echo "<center>$row[$i]</center>";
			echo "</td>";
			}
			echo "</tr>\n";
			}

		echo "</table><p /><a href='add_itemqty.php?item=$item_name' target='parameters'>Add to Quantity</a> | <a href='take_itemqty.php?item=$item_name' target='parameters'>Take Some</a></center>";
	}
	mysql_close($link);
?>
</body>
</html>